package com.cskt.petproject178.controller;

import com.cskt.petproject178.pojo.vo.ResultVO;
import com.cskt.petproject178.service.third.WeChatLoginService;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 微信登录控制器
 *
 * @author 27013
 **/

@RestController
@RequestMapping(value = "/ums/user/weChat")
public class WeChatLoginController {

    @Resource
    private WeChatLoginService weChatLoginService;


    @GetMapping(value = "/back")
    public ResultVO<?>  weChatBack(@RequestParam String wxCode){
        String token = weChatLoginService.weChatLoginBack(wxCode);
        Map<String,String> tokenMap = new HashMap<>();
        tokenMap.put("token",token);
        return ResultVO.OK(tokenMap);
    }
}
